#ifndef GlobalsH
#define GlobalsH

  #define _free( x ) if ( x ) { free( x ); x = NULL; }
  #define _free( x ) if ( x ) { free( x ); x = NULL; }

  #define CheckMSG( ) Application->ProcessMessages( )    

  #define WRAM( x ) *(WORD *)&cpu.ram[ x ]
  #define LRAM( x ) *(LONG *)&cpu.ram[ x ]

  #define WGET( x, y ) *(WORD *)&x[ y ]
  #define LGET( x, y ) *(LONG *)&x[ y ]

  #include <vcl.h>
  #include <conio.h>
  #include <stdio.h>
  #include <string.h>
  #include <stdlib.h>
  #include <dir.h>

  typedef struct _REGZ
  {
    WORD a,
         x,
         y,
         stack;
  } TREG;

  typedef struct _ROMD
  {
    LONG posi,
         offs,
         Header,
         Length;
    BYTE *rom,
         *ram;
    WORD lpCPos,
         lpRPos;
  } TROM;

  typedef struct _RECOMP
  {
    WORD count,
         most,
         most_posi,
         posi,
         back_posi,
         bit_pos;
    BYTE buffer[18];
  } COMP;

  extern TREG reg;
  extern TROM cpu;
  extern COMP cmp;
  extern FILE *rf;
  extern FILE *df;
  extern LONG Start;
  extern LONG End;

  extern char romf[512];
  extern char txtf[512];
  extern char dirc[512];
  extern char cur_dir[MAXPATH];  

  extern LONG Snes2Pc( LONG ofs );
  extern LONG FileSize( FILE *tf );
  extern int  LoadTagData( FILE *tf );

  #include "FS2_main.h"  

#endif
